/*************************************************************************
	> File Name: P1313.cpp
	> Author: yufangze
	> Mail: 2224590123@qq.com
	> Created Time: 2025-02-11 10:37:43
 ************************************************************************/
#include <iostream>
#include <set>
#include <map>
#include <vector>
#include <algorithm>
using namespace std;

#define MAX_N 1000
const int mod = 10007;
int C[MAX_N + 5][MAX_N + 5];

void init() {
    for (int i = 0; i <= MAX_N; i++) {
        C[i][0] = 1;
        C[i][i] = 1;
    }
    for (int i = 2; i <= MAX_N; i++) {
        for (int j = 1; j <= MAX_N; j++) {
            C[i][j] = C[i - 1][j] + C[i - 1][j - 1];
            C[i][j] %= mod;
        }
    }
    return ;
}

int q_pow(long a, long b) {
    long long res = 1;
    while (b) {
        if (b & 1) res = (res * a) % mod;
        a = (a * a) % mod;
        b >>= 1;
    }
    return res;
}

int main() {
    int a, b, k, n, m;
    cin >> a >> b >> k >> n >> m;
    init();
    long long ans = (C[k][n] * q_pow(a, n)) % mod;
    ans = (ans * q_pow(b, m)) % mod;
    cout << ans << endl;
    return 0;
}
